package com.hbt.myplus.utils;

import lombok.Data;

@Data
public class ResponseWeb<T> {


  public ResponseWeb() {

  }

  public int getCode() {
    return code;
  }

  public void setCode(int code) {
    this.code = code;
  }

  public String getMsg() {
    return msg;
  }

  public void setMsg(String msg) {
    this.msg = msg;
  }

  public T getRes() {
    return res;
  }

  public void setRes(T res) {
    this.res = res;
  }

  public ResponseWeb(String msg) {
    super();
    this.code = 0;
    this.msg = msg;
    this.res = null;
  }
  public static ResponseWeb fail(String msg){
    ResponseWeb<String> responseWeb = new ResponseWeb<>();
    responseWeb.setCode(-1);
    responseWeb.setMsg(msg);
    return responseWeb;
  }
  public ResponseWeb(T data) {
    super();
    this.code = 0;
    this.msg = "返回成功";
    this.res = data;
  }

  int code;
  String msg;
  T res;
}
